<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
<title>选择人员</title>
<link rel="stylesheet" href="/css/bootstrap.min.css" />
<link rel="stylesheet" href="/fonts/font-awesome.min.css"/>
<link rel="stylesheet" href="/dist/css/AdminLTE.min.css" />
<link rel="stylesheet" href="/plugins/iCheck/flat/blue.css" />
<link rel="stylesheet" href="/css/admin.css" />
<!--[if lt IE 9]>
<script src="/js/html5shiv.min.js"></script>
<script src="/js/respond.min.js"></script>
<![endif]-->
<script src="/js/jquery.js"></script>
<script src="/js/admin.js"></script>
</head>

<body class="hold-transition skin-blue sidebar-mini">


<script type="text/javascript">

function __doPostBack(type=0){

	var con;
	obj = document.getElementsByName("userid");
    check_val = '';
    check_title = [];
    for(k in obj){
        if(obj[k].checked){
        	
            check_val = check_val + '-' + obj[k].value+'-';
       	    check_title.push(obj[k].title);
       	}
    }
	console.log(check_val);
	//子窗口给父窗口元素赋值
	//var val=$("input:checkbox[name='userid']:checked").val();
	
	if(check_val == false){
		alert('你还没有选择任何内容');
	}else{
		//子窗口给父窗口元素赋值
		var title=$("input:checkbox[name='userid']:checked").attr('title');
		
		if(type == 1)
		{
			var parent_managerName = $("#manager",window.parent.document).val();
			var parent_manager = $("#managerid",window.parent.document).val();
			
			check_title.push(parent_managerName);
			check_val = check_val + parent_manager;
			
			$("#manager",window.parent.document).attr("value", check_title);
			$("#managerid",window.parent.document).attr("value", check_val);
		}
		else
		{
			$("#manager",window.parent.document).attr("value", check_title);
			$("#managerid",window.parent.document).attr("value", check_val);
		}
		
		var index=parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	}
}




</script>


<div class="content-wrapper-simple">

<section class="content">

<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
	<h3 class="box-title">
		<a href="javascript:__doPostBack()"><span class="label label-success"><i class="fa fa-plus"></i> 确认选择</span></a>
		<a href="javascript:__doPostBack(1)"><span class="label label-success"><i class="fa fa-plus"></i> 追加选择</span></a>
	</h3>
	<div class="box-tools">
		<form class="form-inline">

		

		<div class="input-group" style="width: 150px;">
		  <!-- <input type="hidden" name="type" id="type" value="{$_GET.type}" /> -->
		  
		  <input name="keyword" type="text" value="{$_GET.keyword}" class="form-control input-sm pull-right" placeholder="查找..." />
		  <div class="input-group-btn">
			<button type="submit" class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
		  </div>
		</div>
		</form>
	</div>
</div>
<div class="box-body" style="height:350px; overflow:scroll;">

	<form name="form1" method="post" action="" id="form1">
		<table class="table table-hover" cellspacing="0" border="0" >
			<tr>
				<th scope="col">选择</th><th scope="col">权限名称</th><th scope="col">用户名</th><th scope="col">姓名</th><th scope="col">电话</th><th scope="col">单位</th><th scope="col">部门职务</th>
			</tr>
			{volist name="list" id="vo"}
			<tr>
				<td><input id="userid" type="checkbox" name="userid" title="{$vo.realname}" value="{$vo.userid}" /></td>
				<td>{$vo.remarks}</td>
				<td>{$vo.username}</td>
				<td>{$vo.realname}</td>
				<td>{$vo.telephone}</td>
				<td>{$vo.userrole}</td>
				<td>{$vo.bmzw}</td>
			</tr>
			{/volist}
		</table>
	</form>

</div>
<div id="pager">
	{$list->render()}
</div>

</div>
</div>
</div>

</section>

</div>



<script src="/plugins/iCheck/icheck.min.js"></script>
<script>
$(function () {
	$('input').iCheck({
		checkboxClass: 'icheckbox_flat-blue',
		radioClass: 'iradio_flat-blue',
		increaseArea: '20%'
	});
	
	$(".table").on("click", "tr", function () {
		var input = $(this).find("input");
		$(input).iCheck('toggle');
	});
});
</script>

</body>
</html>
